
const CryptoJS = require("crypto-js");
function decryptUrl(t, e) {
    if (!t || !e)
        return "";
    let r = t.split("?")
      , n = r[0].split("/")
      , p = n[n.length - 1].split(".")
      , i = [p[0].slice(0, 32), p[0].slice(32)];
    return i[0] = decryptAes(i[0], e),
    p[0] = i.join(""),
    n[n.length - 1] = p.join("."),
    r[0] = n.join("/"),
    r.join("?")
}

function encryptMd5(t) {
    return t ? CryptoJS.MD5(t).toString() : ""
}
function decryptAes(t, e) {
    if (!t || !e)
        return "";
    let r = encryptMd5(e = e.repeat(16).slice(-16)).slice(8, 24)
      , n = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Hex.parse(t))
      , p = CryptoJS.AES.decrypt(n, CryptoJS.enc.Utf8.parse(e), {
        iv: CryptoJS.enc.Utf8.parse(r),
        mode: CryptoJS.mode.CBC,
        padding: CryptoJS.pad.ZeroPadding
    })
      , i = "";
    try {
        i = p.toString(CryptoJS.enc.Utf8)
    } catch (e) {
        return t
    }
    return i || t
}

console.log(decryptUrl("https://imglf5.lf127.net/img/0835891503b633b7/290efdae73226c9dc344e98009040f91eTRBaDFycVJNdGtpeTB5Q3Q5ckU.jpg","timeline"))

